package cc.vv.btpartyjob.partyservice.adapter

import android.widget.ImageView
import android.widget.TextView
import cc.vv.baselibrary.adapter.SimpleCommonAdapter
import cc.vv.baselibrary.adapter.holder.ExtendViewHolder
import cc.vv.btpartyjob.jnimodule.moudel.bean.NewsBean
import cc.vv.btpartyjob.jnimodule.server.OperationServer
import cc.vv.btpartyjob.partyservice.R
import cc.vv.lkimagecomponent2.LKImage
import cc.vv.lkimagecomponent2.lib.mode.ScaleMode

/**
 * 新闻列表adapter
 * Created by Chen.qi on 2018/10/24.
 */
class PartyGroupNewAdapter(layoutResId: Int) : SimpleCommonAdapter<NewsBean>(layoutResId) {
    override fun convert(helper: ExtendViewHolder, item: NewsBean, position: Int) {

        LKImage.load().scale(ScaleMode.CENTER_CROP)
                .crossFade(300).placeHolder(R.mipmap.icon_def_image)
                .error(R.mipmap.icon_def_image).load(item.thumbnail).into(helper.getView<
                ImageView>(R.id.iv_inl_itemPic))

        //title
        helper.getView<TextView>(R.id.tv_inl_listDataTime)?.text = item.title
        //时间
        helper.getView<TextView>(R.id.tv_inl_listTitle)?.text = OperationServer.formatStr(item.createTime)
    }
}